package chap10collection.test12_14;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author zdl
 * @date 2024/12/18
 */
public class Demo12_14 {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("Tom", "CoreJava");
        map.put("John", "Oracle");
        map.put("Susan", "Oracle");
        map.put("Jerry", "JDBC");
        map.put("Jim", "Unix");
        map.put("Kevin", "JSP");
        map.put("Lucy", "JSP");
        map.put("Allen", "JDBC");
        map.put("Lucy", "CoreJava");
        Set<Map.Entry<String, String>> entries = map.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            System.out.println(entry.getKey() + "\t" + entry.getValue());
        }
        System.out.println();
        for (Map.Entry<String, String> entry : entries) {
            String key = entry.getKey();
            String value = entry.getValue();
            if (value.equals("JSP")){
                System.out.println("教授JSP课程的老师是:"+key);
            }
        }
    }
}
